<script type='text/javascript' src="<?php echo $this->basePath('public/css/dbblack/js/artdialog/artDialog.js?skin=simple'); ?>"></script>
<script type='text/javascript' src="<?php echo $this->basePath('public/css/dbblack/js/artdialog/plugins/iframeTools.js'); ?>"></script>
<link rel="stylesheet" type="text/css" href="<?php echo $this->basePath('public/css/dbblack/js/form/style.css'); ?>"/>
<script type='text/javascript' src="<?php echo $this->basePath('public/css/dbblack/js/form/form.js'); ?>"></script>
<div class="simple-box " style="width:600px;margin:40px auto;" >
    <form action="" method="post">
        <?php
        if (isset($this->message) and $this->message != '') {
            echo '<br><h4>' . $this->message . '</h4>';
        } else {
            ?>
            <ul class="form">
                <li><span class="perfix fa">&#xf007;</span><input readonly disabled value="<?php echo $this->user_name; ?>" class="input"></li>
                <li>
                    <span class="perfix fa">&#xf023;</span><input bind="user_com_passwd" minlen=6 maxlen=20 class="input" type="password" name="user_password" pattern="required" placeholder="<?php echo $this->translate('密码'); ?>" alt="<?php echo $this->translate('6-20任意字符组合'); ?>">
                </li>
                <li>
                    <span class="perfix fa">&#xf084;</span><input bind="user_password" minlen=6 maxlen=20 class="input" type="password"  name="user_com_passwd" pattern="required" placeholder="<?php echo $this->translate('确认密码'); ?>" alt="<?php echo $this->translate('6-20任意字符组合'); ?>">
                </li>
                <li><span class="perfix fa">&#xf02a;</span><input type="text" class="input-sm" name="captcha_code" id="captcha_code"  pattern="\w{5}" maxlength="5" style="width: 80px;" placeholder="<?php echo $this->translate('验证码'); ?>"><span id="forgot_captcha_id"></span></li>
                <li><input type="submit" class="btn btn-main" value="<?php echo $this->translate('重置密码'); ?>"></li>
            </ul>
        <?php } ?>
    </form>
</div>
<script type="text/javascript">
    $("input[name='captcha_code']").on("change",function(event){
        if(autoValidate.validate(event)){
            $.post("<?php echo $this->url('shopfront/default/captcha-check',array('action'=>'captcha','captcha_check'=>1)); ?>",{captcha_code:$(this).val()},function(data){
                if(data == 'false') {
                    autoValidate.showMsg({id:document.getElementById('captcha_code'),error:true,msg:'<?php echo $this->translate('验证码错误！'); ?>'});
                }
            });
        }
    });
    //验证码添加
    function captchaAdd() {
        $.get("<?php echo $this->url('shopfront/default',array('action'=>'captcha')); ?>",'',
            function(data){
                $("#forgot_captcha_id").html('<img src="<?php echo $this->basePath('/'); ?>'+data.captcha_file+'" border="0" >&nbsp;&nbsp;<a href="javascript:;" onclick="captchaAdd()"><?php echo $this->translate('更换验证码'); ?></a>');
            },'json');
    }
    captchaAdd();

</script>
